/**
 * Created by 123 on 2017/12/7.
 * 问题集
 */

import React from 'react'
import {connect} from 'dva-no-router'
import {bindActionCreators} from 'redux'

import UI from '../components/troubleCollection'

class App extends React.Component {

  componentDidMount() {
    const {queryTroubleCollection} = this.props;
    queryTroubleCollection()
  }
  // componentWillUnmount(){
  //   const {resetNormalList}=this.props;
  //     resetNormalList();
  // }

  render() {

    return (
      <UI {...this.props} />
    )
  }
}

const actions = {
  queryTroubleCollection: () => ({type: 'troubleCollection/queryTroubleCollection'}),

  queryTroubleCollectionItem: (id,name) => ({type: 'troubleCollection/queryTroubleCollectionItem', payload: {id:id,name:name}}),

  setTroubles: () => ({type: 'troubleCollection/setTroubles'}),

  changeGradeName: (text) => ({type: 'troubleCollection/changeGradeName', payload: text}),

  thisBoxChecked: (val) => ({type: 'troubleCollection/thisBoxChecked', payload: val}),

  // resetNormalList: () => ({type: 'troubleCollection/resetNormalList'}),

  allCheckBox:(val) => ({type: 'troubleCollection/allCheck', payload: val}),
}

const mapProps = ({troubleCollection}) => ({...troubleCollection});

const mapActions = dispatch => ({
  ...bindActionCreators({...actions}, dispatch)
});

export default connect(mapProps, mapActions)(App)